<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@include file="/front-end/views/common/head.jsp"%>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的订单</title>
    <style>
        *{
            margin:0;
            padding:0;
            list-style: none;
            text-decoration: none;
        }
        #head{
            width:100%;
            height:100px;
            background-color: #e5e5e5;
        }
        #head li{
            margin-top: 40px;
            float:left;
            height:39px;
            line-height: 39px;
            padding:0 20px;
            text-align:center;
            cursor:pointer;
            list-style: none;
            font-size: 30px;
        }
        #head img{
            float:left;
            height:100px;
        }
        #main{
            /* background-color: red; */
            width:100%;
            height:1200px;
        }
        .current{
            background-color: #c81623;
            color:#fff;
        }
        .item{
            display:none;
        }
        #lunbotu{
            margin:0 auto;
            overflow: hidden;
            position: relative;
            width:1700px;
            height:450px;
            background-color: white;
        }
        #lunbotu ul{
            margin:0;
            padding:0;
            position: absolute;
            width:100000px;
        }
        #lunbotu ul li{
            float:left;
        }
        #lunbotu ul li img{
            width:1700px;
            height: 440px;
        }
        ol{
            position: absolute;
            top:380px;
            left:75%;
            z-index:999;
        }
        ol li{
            margin:10px;
            float:left;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: purple;
        }
        .current{
            background-color: red;
        }
        
        .currentt{
            /* font-size: 300px; */
            color: red;
        }
        #left,
        #right{
            display: none;
            position: absolute;
            width: 50px;
            height: 50px;
            background-color: purple;
            top:40%;
            z-index:999;
        }
        #left{
            left:0;
        }
        #right{
            right:0;
        }
        #dianying{
            overflow: hidden;
            width:1300px;
            height:900px;
            margin:0 auto;
            /* background-color: green; */
        }
        #dianying ul li{
            float:left;
            padding:20px;
            font-size: 25px;
            cursor: pointer;
        }
        #dianying .itemone,.itemtwo{
            margin:0 auto;
            margin-top: 50px;
            width:1300px;
            height:800px;
            /* background-color: pink; */

        }
        #jieshao{
            width:200px;
            height:300px;
            background-color: purple;
        }
        #xian{
            width:100%;
            height:3px;
            float:left;
            margin-top: -20px;
            background-color: rgb(83, 81, 81);
        }
        .ying{
            position: relative;
            overflow: hidden;
            width: 220px;
            height: 300px;
            float:left;
            margin:20px;
            background-color: #e5e5e5;
        }
        .ying #top{
            /* float: left; */
            width: 220px;
            height:240px;
            background-color: red;
        }
        .ying #bottom{
            width: 220px;
            height:6px;
            /* float:left; */
            background-color: pink;
        }
        .ying img{
       
            width: 220px;
            height:240px;
        }
        .ying input{
            position: absolute;
            z-index:999;
            border: 1px solid #eb002a;
            width: 220px;
            height:60px;
            font-size: 20px;
            background-color: #eb002a;
            color:white;
            cursor: pointer;
        }
        
        #cover{
            position: absolute;
            width: 220px;
            color:white;
            height: 300px;
            background-color:black;
            bottom:-300px;
            opacity: .6;
        }
        #cover p{
            margin:10px;
        }
        .ying:hover #cover{
        height:300px;
        bottom:0;
        transition: all .6s ease;
        }
        #guanying{
        overflow: hidden;
        width:1300px;
        height:900px;
        margin:0 auto;
        /* background-color: green; */
        }
        #guanying li{
            margin-top: 10px;
            float:left;
            height:39px;
            line-height: 39px;
            padding:0 20px;
            text-align:center;
            cursor:pointer;
            list-style: none;
            font-size: 25px;
        }
        .itemthree{
            margin:0 auto;
            margin-top:70px;
            width:1300px;
            height:800px;
            /* background-color: pink; */
        }
        #ccover{
            width: 220px;
            color:white;
            height: 310px;
            background-color:black;
            opacity: .6;
            margin-top: -250px;
            /* border-radius: 50%; */
        }
        #ccover h1{
            text-align: center;
            line-height: 280px;
            font-size: 50px;

        }
        .yying{
            position: relative;
            overflow: hidden;
            width: 220px;
            height: 300px;
            float:left;
            margin:20px;
            background-color: #e5e5e5;
        }
        .yying #top{
            /* float: left; */
            width: 220px;
            height:240px;
            background-color: red;
        }
        .yying #bottom{
            width: 220px;
            height:6px;
            /* float:left; */
            background-color: pink;
        }
        .yying img{
       
            width: 220px;
            height:240px;
        }
        .yying input{
            /* position: absolute; */
            /* z-index:999; */
            border: 1px solid #eb002a;
            width: 220px;
            height:60px;
            font-size: 20px;
            background-color: #eb002a;
            color:white;
            cursor: pointer;
        }
    </style>
</head>
<body>
<div id="head">
    <img src="front-end/img/logo.png" alt="">
    <ul>
        <li ><a href="index.jsp">首页</a></li>
        <li><a href="user/indexServlet?action=play">影片</a></li>
        <li class="current"><a href="user/indexServlet?action=myOrder">我的订单</a></li>
        <li style="float:right;text-decoration: none; "><a style="color:black;" href="userServlet?action=logout">注销</a>   &nbsp;</li>
    </ul>
</div>
    <div id="main">
        <div class="item" style="display:block;">
            <div id="guanying">
                <ul>
                    <li class="currentt">全部订单</li>
<%--                    <li>已放映</li>--%>
                </ul>
                <div id="xian" style="margin-top: 5px;"></div>
                <div class="itemthree" style="display:block;">
                    <c:forEach items = "${requestScope.saleItemList}" var="item">
                     <div>
                         <div class="ying">
                            <div id="top">
                                <c:forEach items = "${requestScope.tickets}" var="ticket">
                                    <c:if test="${ticket.ticket_id == item.ticket_id}">
                                        <c:forEach items = "${requestScope.schedules}" var="schedule">
                                            <c:if test="${ticket.sched_id == schedule.sched_id}">
                                                <c:forEach items = "${requestScope.plays}" var="play">
                                                    <c:if test="${play.play_id == schedule.sched_id}">
                                                        <img src="${play.play_image}" alt="">
                                                    </c:if>
                                                </c:forEach>
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                </c:forEach>
                            </div>
                            <div id="bottom">

                                <c:forEach items = "${requestScope.tickets}" var="ticket">
                                    <c:if test="${ticket.ticket_id == item.ticket_id}">
                                        <c:forEach items = "${requestScope.schedules}" var="schedule">
                                            <c:if test="${ticket.sched_id == schedule.sched_id}">
                                                <a href="/ttms/user/indexServlet?action=orderDetail&sched_id=${schedule.sched_id}&ticket_id=${ticket.ticket_id}">
                                                    <input type="button" value="点击查看详情">
                                                </a>
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                </c:forEach>

                            </div>
                            <div id="cover">
                                <p>票价：${item.sale_item_price}</p>
                                <c:forEach items = "${requestScope.tickets}" var="ticket">
                                    <c:if test="${ticket.ticket_id == item.ticket_id}">
                                        <c:forEach items = "${requestScope.seats}" var="seat">
                                            <c:if test="${ticket.seat_id == seat.seat_id}">
                                                <p>座位：第${seat.seat_row}行   第${seat.seat_column}列</p>
                                            </c:if>
                                        </c:forEach>
                                        <c:forEach items = "${requestScope.schedules}" var="schedule">
                                            <c:if test="${ticket.sched_id == schedule.sched_id}">
                                                <p>演出厅：${schedule.studio_id}号厅</p>
                                            </c:if>
                                        </c:forEach>
                                    </c:if>
                                </c:forEach>
                            </div>
                        </div>
                     </div>
                    </c:forEach>
                </div>
                <div class="itemthree" style="display:none;">
                    <div>
                        <div class="yying">
                            <div id="top">
                                <img src="one.png" alt="">
                            </div>
                            <div id="bottom">
                                <a href="orderdetail.jsp">
                                    <input type="button" value="点击查看详情">
                                </a>
                            </div>
                            <div id="ccover">
                                <h1>已放映</h1>
                            </div>
                        </div>
                        <div class="yying">
                            <div id="top">
                                <img src="one.png" alt="">
                            </div>
                            <div id="bottom">
                                <a href="orderdetail.jsp">
                                    <input type="button" value="点击查看详情">
                                </a>
                            </div>
                            <div id="ccover">
                                <h1>已放映</h1>
                            </div>
                        </div>
                        <div class="yying">
                            <div id="top">
                                <img src="one.png" alt="">
                            </div>
                            <div id="bottom">
                                <a href="orderdetail.jsp">
                                    <input type="button" value="点击查看详情">
                                </a>
                            </div>
                            <div id="ccover">
                                <h1>已放映</h1>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<script>
    var lis = document.getElementById('head').querySelectorAll('li');
        var items = document.getElementById('main').querySelectorAll('.item');

        for(var i = 0;i<lis.length;i++){
            lis[i].setAttribute('index',i);
            lis[i].onclick = function (){
                for(var i =0;i<lis.length;i++){
                    lis[i].className = '';
                }
                this.className = 'current';
                var index = this.getAttribute('index');
                for(var i = 0;i<items.length;i++){
                    items[i].style.display = 'none';
                }
                items[index].style.display = 'block';
            }
        }
        window.addEventListener('load',function(){
        var box = document.querySelector('#lunbotu');
        var ul = box.querySelector('ul');
        var uli = box.querySelectorAll('li');
        var img = document.querySelector('img');
        var ol = document.querySelector('ol');
        var left = document.querySelector('#left');
        var right = document.querySelector('#right');
        var boxWidth = box.offsetWidth;


        //box
        box.addEventListener('mouseenter',function(){
            left.style.display = 'block';
            right.style.display = 'block';
            clearInterval(timer);
        })
        box.addEventListener('mouseleave',function(){
            left.style.display = 'none';
            right.style.display = 'none';
            timer = setInterval(function(){
                right.click();
            },2000);
        })
        


        //小圈圈
        for(var i = 0;i<uli.length;i++){
            var oli = document.createElement('li');
            ol.appendChild(oli);
            oli.setAttribute('index',i);
            oli.addEventListener('click',function(){
                for(var i = 0;i<ol.children.length;i++){
                    ol.children[i].className='';
                }
                this.className = 'current';

                var index = this.getAttribute('index');
                circle = index;
                num = index;
                animate(ul,-index*boxWidth);
            })
        }
        ol.children[0].className = 'current';
        var first = ul.children[0].cloneNode(true);
        ul.appendChild(first);


        //左右键
        var num = 0;
        var circle = 0;
        right.addEventListener('click',function(){
            if(num ==ul.children.length-1){
                ul.style.left = 0;
                num = 0;
            }
            num++;
            animate(ul,-num * boxWidth);


            circle++;
            if(circle == ul.children.length-1){
                circle =0;
            }
            for(var i = 0;i<ol.children.length;i++){
                ol.children[i].className = '';
            }
            ol.children[circle].className='current';
            
            
        })
        left.addEventListener('click',function(){
            if(num == 0){
                ul.style.left = (ul.children.length-1)*boxWidth;
            }
            num--;

            circle--;
            if(circle <0){
                circle = ol.children.length -1;
            }
            for(var i = 0;i<ol.children.length;i++){
                ol.children[i].className = '';
            }
            ol.children[circle].className='current';
            animate(ul,-num*boxWidth);
        })
        var timer = setInterval(function(){
            right.click();
        },8000)



        function animate(obj,target){
            clearInterval(obj.timer);
            obj.timer = setInterval(function(){
                var step = (target - obj.offsetLeft) / 10;
                step = step > 0? Math.ceil(step) : Math.floor(step);
                if(obj.offsetLeft == target){
                    clearInterval(obj.timer);
                }     
            obj.style.left = obj.offsetLeft + step + 'px';
            },20); 
        }



    })

    var dianying = document.querySelector('#dianying');
    var li = dianying.querySelectorAll('li');
    var itemone = document.querySelectorAll('.itemone');
    for(var i = 0;i<li.length;i++){
            li[i].setAttribute('index',i);
            li[i].onclick = function (){
                for(var i =0;i<li.length;i++){
                    li[i].className = '';
                }
                this.className = 'currentt';
                var index = this.getAttribute('index');
                for(var i = 0;i<itemone.length;i++){
                   itemone[i].style.display = 'none';
                }
               itemone[index].style.display = 'block';
            }
        }
        var guanying = document.querySelector('#guanying');
        var lili = guanying.querySelectorAll('li');
        var itemthree = document.querySelectorAll('.itemthree');
        for(var i = 0;i<lili.length;i++){
                lili[i].setAttribute('index',i);
                lili[i].onclick = function (){
                    for(var i =0;i<lili.length;i++){
                        lili[i].className = '';
                    }
                    this.className = 'currentt';
                    var index = this.getAttribute('index');
                    for(var i = 0;i<itemthree.length;i++){
                    itemthree[i].style.display = 'none';
                    }
                itemthree[index].style.display = 'block';
                }
            }
</script>
</html>